Class HumanAgent

java.lang.Object
edu.uky.ai.lp.ai.HumanAgent
All Implemented Interfaces:
Agent

public class HumanAgent
extends java.lang.Object
implements Agent
An implementation of Agent that allows a human to play the game by typing commands into the console.
Author:
Stephen G. Ware
  • Constructor Summary

    Constructors 
    Constructor Description
    HumanAgent​(Console console)
    Creates a new human agent which accepts input via the console.
  • Method Summary

    Modifier and Type Method Description
    Action chooseAction​(Game game)
    Chooses the next move for the player to make.
    void observe​(Result result)
    Alerts the player to the result of the most recent action.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HumanAgent

      public HumanAgent​(Console console) throws java.io.IOException
      Creates a new human agent which accepts input via the console.
      Parameters:
      console - the console from which to get input
      Throws:
      java.io.IOException - if an I/O exception occurs
  • Method Details

    • chooseAction

      public Action chooseAction​(Game game)
      Description copied from interface: Agent
      Chooses the next move for the player to make.
      Specified by:
      chooseAction in interface Agent
      Parameters:
      game - the current state of the game
      Returns:
      the action the player should take
    • observe

      public void observe​(Result result)
      Description copied from interface: Agent
      Alerts the player to the result of the most recent action.
      Specified by:
      observe in interface Agent
      Parameters:
      result - the result of the most recent action